const axios = require('axios');
import { ElMessage } from 'element-plus'
var goBack =  function(url,method,data) {
    var res = ""
    if(method=="get"){
         axios
          .get(url,{
              params:data
          })
          .then(
            function (res){
                console.log(res.data)
                if(res.data.resultmsg.code==400001){
                    ElMessage.warning({
                        message:res.data.resultmsg.msg,
                        type: 'warning',
                        center:true
                    });
                }else if(res.data.resultmsg.code==200){
                    ElMessage.success({
                        message:res.data.resultmsg.msg,
                        type: 'success',
                        center:true
                    });
                }
            }
          )
          .catch(function (error) { // 请求失败处理
            console.log(error);
          });
        return res
    }
}
export default goBack;